﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.SceneManagement;

// Token: 0x02000332 RID: 818
public class AssetBundleManager : Singleton<AssetBundleManager>
{
	// Token: 0x170001FD RID: 509
	// (get) Token: 0x06001490 RID: 5264 RVA: 0x0008EEA8 File Offset: 0x0008D0A8
	public static string BaseDownloadingURL
	{
		get
		{
			return AssetBundleManager.m_BaseDownloadingURL;
		}
	}

	// Token: 0x170001FE RID: 510
	// (get) Token: 0x06001491 RID: 5265 RVA: 0x0008EEB0 File Offset: 0x0008D0B0
	// (set) Token: 0x06001492 RID: 5266 RVA: 0x0008EEBC File Offset: 0x0008D0BC
	public static string[] Variants
	{
		get
		{
			return AssetBundleManager.MainBundle.Variants;
		}
		set
		{
			AssetBundleManager.MainBundle.Variants = value;
		}
	}

	// Token: 0x06001493 RID: 5267 RVA: 0x0008EECC File Offset: 0x0008D0CC
	public static AssetBundleManager.BundlePack ManifestAdd(string manifestAssetBundleName)
	{
		if (AssetBundleManager.m_ManifestBundlePack.ContainsKey(manifestAssetBundleName))
		{
			return null;
		}
		AssetBundleManager.BundlePack bundlePack = new AssetBundleManager.BundlePack();
		AssetBundleManager.m_ManifestBundlePack.Add(manifestAssetBundleName, bundlePack);
		LoadedAssetBundle loadedAssetBundle = AssetBundleManager.LoadAssetBundle(manifestAssetBundleName, false, manifestAssetBundleName);
		if (loadedAssetBundle == null)
		{
			AssetBundleManager.m_ManifestBundlePack.Remove(manifestAssetBundleName);
			return null;
		}
		AssetBundleLoadAssetOperationSimulation assetBundleLoadAssetOperationSimulation = new AssetBundleLoadAssetOperationSimulation(loadedAssetBundle.m_AssetBundle.LoadAsset("AssetBundleManifest", typeof(AssetBundleManifest)));
		if (assetBundleLoadAssetOperationSimulation.IsEmpty())
		{
			AssetBundleManager.m_ManifestBundlePack.Remove(manifestAssetBundleName);
			return null;
		}
		bundlePack.AssetBundleManifest = assetBundleLoadAssetOperationSimulation.GetAsset<AssetBundleManifest>();
		return bundlePack;
	}

	// Token: 0x170001FF RID: 511
	// (get) Token: 0x06001494 RID: 5268 RVA: 0x0008EF60 File Offset: 0x0008D160
	public static HashSet<string> AllLoadedAssetBundleNames
	{
		get
		{
			return AssetBundleManager.m_AllLoadedAssetBundleNames;
		}
	}

	// Token: 0x17000200 RID: 512
	// (get) Token: 0x06001495 RID: 5269 RVA: 0x0008EF68 File Offset: 0x0008D168
	public static Dictionary<string, AssetBundleManager.BundlePack> ManifestBundlePack
	{
		get
		{
			return AssetBundleManager.m_ManifestBundlePack;
		}
	}

	// Token: 0x17000201 RID: 513
	// (get) Token: 0x06001496 RID: 5270 RVA: 0x0008EF70 File Offset: 0x0008D170
	public static float Progress
	{
		get
		{
			int num = AssetBundleManager.MainBundle.LoadedAssetBundles.Count;
			float num2 = (float)num;
			foreach (AssetBundleCreate assetBundleCreate in AssetBundleManager.MainBundle.CreateAssetBundles.Values)
			{
				num++;
				num2 += assetBundleCreate.m_CreateRequest.progress;
			}
			return (num != 0) ? (num2 / (float)num) : 1f;
		}
	}

	// Token: 0x06001497 RID: 5271 RVA: 0x0008F008 File Offset: 0x0008D208
	public static LoadedAssetBundle GetLoadedAssetBundle(string assetBundleName, out string error, string manifestAssetBundleName = null)
	{
		assetBundleName = (assetBundleName ?? string.Empty);
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		if (bundlePack.DownloadingErrors.TryGetValue(assetBundleName, out error))
		{
			return null;
		}
		LoadedAssetBundle loadedAssetBundle = null;
		bundlePack.LoadedAssetBundles.TryGetValue(assetBundleName, out loadedAssetBundle);
		if (loadedAssetBundle == null)
		{
			return null;
		}
		LoadedAssetBundleDependencies loadedAssetBundleDependencies = bundlePack.Dependencies.Find((LoadedAssetBundleDependencies p) => p.m_Key == assetBundleName);
		if (loadedAssetBundleDependencies == null)
		{
			return loadedAssetBundle;
		}
		foreach (string key in loadedAssetBundleDependencies.m_BundleNames)
		{
			if (bundlePack.DownloadingErrors.TryGetValue(assetBundleName, out error))
			{
				return loadedAssetBundle;
			}
			LoadedAssetBundle loadedAssetBundle2;
			bundlePack.LoadedAssetBundles.TryGetValue(key, out loadedAssetBundle2);
			if (loadedAssetBundle2 == null)
			{
				return null;
			}
		}
		return loadedAssetBundle;
	}

	// Token: 0x06001498 RID: 5272 RVA: 0x0008F10C File Offset: 0x0008D30C
	public static void Initialize(string basePath)
	{
		if (AssetBundleManager.isInitialized)
		{
			return;
		}
		AssetBundleManager.m_BaseDownloadingURL = basePath;
		GameObject gameObject = new GameObject("AssetBundleManager", new Type[]
		{
			typeof(AssetBundleManager)
		});
		UnityEngine.Object.DontDestroyOnLoad(gameObject);
		if (AssetBundleManager.MainBundle == null)
		{
			AssetBundleManager.MainBundle = AssetBundleManager.ManifestAdd("abdata");
		}
		if (Directory.Exists(basePath))
		{
			IEnumerable<string> source = from s in Directory.GetFiles(basePath, "*.*", SearchOption.TopDirectoryOnly)
			where Path.GetExtension(s).IsNullOrEmpty()
			select s;
			if (AssetBundleManager.callback0 == null)
			{
				AssetBundleManager.callback0 = new Func<string, string>(Path.GetFileNameWithoutExtension);
			}
			foreach (string manifestAssetBundleName in from s in source.Select(AssetBundleManager.callback0)
			where Regex.Match(s, "studio(\\d*)").Success
			select s)
			{
				AssetBundleManager.ManifestAdd(manifestAssetBundleName);
			}
		}
		if (Directory.Exists(basePath))
		{
			IEnumerable<string> source2 = from s in Directory.GetFiles(basePath, "*.*", SearchOption.TopDirectoryOnly)
			where Path.GetExtension(s).IsNullOrEmpty()
			where Path.GetExtension(s) == ".ilm"
			select s;
			if (AssetBundleManager.callback1 == null)
			{
				AssetBundleManager.callback1 = new Func<string, string>(Path.GetFileNameWithoutExtension);
			}
			foreach (string manifestAssetBundleName2 in from s in source2.Select(AssetBundleManager.callback1)
			where s != "abdata"
			select s)
			{
				AssetBundleManager.ManifestAdd(manifestAssetBundleName2);
			}
		}
		AssetBundleManager.isInitialized = true;
		InitAddComponent.AddComponents(gameObject);
	}

	// Token: 0x06001499 RID: 5273 RVA: 0x0008F31C File Offset: 0x0008D51C
	private static LoadedAssetBundle LoadAssetBundle(string assetBundleName, bool isAsync, string manifestAssetBundleName = null)
	{
		bool flag = assetBundleName == manifestAssetBundleName;
		if (!flag)
		{
			assetBundleName = AssetBundleManager.RemapVariantName(assetBundleName, manifestAssetBundleName);
		}
		if (!AssetBundleManager.LoadAssetBundleInternal(assetBundleName, isAsync, manifestAssetBundleName) && !flag)
		{
			AssetBundleManager.LoadDependencies(assetBundleName, isAsync, manifestAssetBundleName);
		}
		string text;
		return AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out text, manifestAssetBundleName);
	}

	// Token: 0x0600149A RID: 5274 RVA: 0x0008F368 File Offset: 0x0008D568
	protected static string RemapVariantName(string assetBundleName, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		string[] allAssetBundlesWithVariant = bundlePack.AssetBundleManifest.GetAllAssetBundlesWithVariant();
		if (Array.IndexOf<string>(allAssetBundlesWithVariant, assetBundleName) < 0)
		{
			return assetBundleName;
		}
		string[] array = assetBundleName.Split(new char[]
		{
			'.'
		});
		int num = int.MaxValue;
		int num2 = -1;
		for (int i = 0; i < allAssetBundlesWithVariant.Length; i++)
		{
			string[] array2 = allAssetBundlesWithVariant[i].Split(new char[]
			{
				'.'
			});
			if (!(array2[0] != array[0]))
			{
				int num3 = Array.IndexOf<string>(bundlePack.Variants, array2[1]);
				if (num3 != -1 && num3 < num)
				{
					num = num3;
					num2 = i;
				}
			}
		}
		if (num2 != -1)
		{
			return allAssetBundlesWithVariant[num2];
		}
		return assetBundleName;
	}

	// Token: 0x0600149B RID: 5275 RVA: 0x0008F444 File Offset: 0x0008D644
	public static bool LoadAssetBundleInternal(string assetBundleName, bool isAsync, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		LoadedAssetBundle loadedAssetBundle = null;
		bundlePack.LoadedAssetBundles.TryGetValue(assetBundleName, out loadedAssetBundle);
		if (loadedAssetBundle != null)
		{
			loadedAssetBundle.m_ReferencedCount += 1U;
			return true;
		}
		AssetBundleCreate assetBundleCreate = null;
		bundlePack.CreateAssetBundles.TryGetValue(assetBundleName, out assetBundleCreate);
		if (assetBundleCreate != null)
		{
			assetBundleCreate.m_ReferencedCount += 1U;
			return true;
		}
		if (!AssetBundleManager.m_AllLoadedAssetBundleNames.Add(assetBundleName))
		{
			Debug.LogErrorFormat("Loaded AssetBundle : {0}\nManifestName : {1}, isAsync : {2}", new object[]
			{
				assetBundleName,
				manifestAssetBundleName,
				isAsync
			});
			return true;
		}
		string path = AssetBundleManager.BaseDownloadingURL + assetBundleName;
		if (!isAsync)
		{
			bundlePack.LoadedAssetBundles.Add(assetBundleName, new LoadedAssetBundle(AssetBundle.LoadFromFile(path)));
		}
		else
		{
			bundlePack.CreateAssetBundles.Add(assetBundleName, new AssetBundleCreate(AssetBundle.LoadFromFileAsync(path)));
		}
		return false;
	}

	// Token: 0x0600149C RID: 5276 RVA: 0x0008F538 File Offset: 0x0008D738
	protected static void LoadDependencies(string assetBundleName, bool isAsync, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		if (object.ReferenceEquals(bundlePack.AssetBundleManifest, null))
		{
			GlobalData.Debug_LogError("Please initialize AssetBundleManifest by calling AssetBundleManager.Initialize()");
			return;
		}
		string[] allDependencies = bundlePack.AssetBundleManifest.GetAllDependencies(assetBundleName);
		if (allDependencies.Length == 0)
		{
			return;
		}
		for (int i = 0; i < allDependencies.Length; i++)
		{
			allDependencies[i] = AssetBundleManager.RemapVariantName(allDependencies[i], manifestAssetBundleName);
		}
		LoadedAssetBundleDependencies loadedAssetBundleDependencies = bundlePack.Dependencies.Find((LoadedAssetBundleDependencies p) => p.m_Key == assetBundleName);
		if (loadedAssetBundleDependencies != null)
		{
			loadedAssetBundleDependencies.m_ReferencedCount++;
		}
		else
		{
			bundlePack.Dependencies.Add(new LoadedAssetBundleDependencies(assetBundleName, allDependencies));
		}
		for (int j = 0; j < allDependencies.Length; j++)
		{
			AssetBundleManager.LoadAssetBundleInternal(allDependencies[j], isAsync, manifestAssetBundleName);
		}
	}

	// Token: 0x0600149D RID: 5277 RVA: 0x0008F644 File Offset: 0x0008D844
	public static void UnloadAssetBundle(AssetBundleData data, bool isUnloadForceRefCount, bool unloadAllLoadedObjects = false)
	{
		AssetBundleManager.UnloadAssetBundle(data.bundle, isUnloadForceRefCount, null, unloadAllLoadedObjects);
	}

	// Token: 0x0600149E RID: 5278 RVA: 0x0008F654 File Offset: 0x0008D854
	public static void UnloadAssetBundle(AssetBundleManifestData data, bool isUnloadForceRefCount, bool unloadAllLoadedObjects = false)
	{
		AssetBundleManager.UnloadAssetBundle(data.bundle, isUnloadForceRefCount, data.manifest, unloadAllLoadedObjects);
	}

	// Token: 0x0600149F RID: 5279 RVA: 0x0008F66C File Offset: 0x0008D86C
	public static void UnloadAssetBundle(string assetBundleName, bool isUnloadForceRefCount, string manifestAssetBundleName = null, bool unloadAllLoadedObjects = false)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		while (AssetBundleManager.UnloadBundleAndDependencies(assetBundleName, manifestAssetBundleName, unloadAllLoadedObjects) && isUnloadForceRefCount)
		{
		}
	}

	// Token: 0x060014A0 RID: 5280 RVA: 0x0008F698 File Offset: 0x0008D898
	private static bool UnloadBundleAndDependencies(string assetBundleName, string manifestAssetBundleName, bool unloadAllLoadedObjects)
	{
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		bool flag = AssetBundleManager.UnloadBundle(assetBundleName, bundlePack, unloadAllLoadedObjects);
		if (flag)
		{
			LoadedAssetBundleDependencies loadedAssetBundleDependencies = bundlePack.Dependencies.Find((LoadedAssetBundleDependencies p) => p.m_Key == assetBundleName);
			if (loadedAssetBundleDependencies != null && --loadedAssetBundleDependencies.m_ReferencedCount == 0)
			{
				foreach (string assetBundleName2 in loadedAssetBundleDependencies.m_BundleNames)
				{
					AssetBundleManager.UnloadBundle(assetBundleName2, bundlePack, unloadAllLoadedObjects);
				}
				bundlePack.Dependencies.Remove(loadedAssetBundleDependencies);
			}
		}
		return flag;
	}

	// Token: 0x060014A1 RID: 5281 RVA: 0x0008F748 File Offset: 0x0008D948
	private static bool UnloadBundle(string assetBundleName, AssetBundleManager.BundlePack targetPack, bool unloadAllLoadedObjects)
	{
		assetBundleName = (assetBundleName ?? string.Empty);
		string text;
		if (targetPack.DownloadingErrors.TryGetValue(assetBundleName, out text))
		{
			return false;
		}
		LoadedAssetBundle loadedAssetBundle = null;
		if (!targetPack.LoadedAssetBundles.TryGetValue(assetBundleName, out loadedAssetBundle))
		{
			return false;
		}
		if ((loadedAssetBundle.m_ReferencedCount -= 1U) == 0U)
		{
			if (loadedAssetBundle.m_AssetBundle)
			{
				loadedAssetBundle.m_AssetBundle.Unload(unloadAllLoadedObjects);
			}
			targetPack.LoadedAssetBundles.Remove(assetBundleName);
			AssetBundleManager.m_AllLoadedAssetBundleNames.Remove(assetBundleName);
		}
		return true;
	}

	// Token: 0x060014A2 RID: 5282 RVA: 0x0008F7DC File Offset: 0x0008D9DC
	private void Update()
	{
		foreach (KeyValuePair<string, AssetBundleManager.BundlePack> keyValuePair in AssetBundleManager.m_ManifestBundlePack)
		{
			AssetBundleManager.BundlePack value = keyValuePair.Value;
			foreach (KeyValuePair<string, AssetBundleCreate> keyValuePair2 in value.CreateAssetBundles)
			{
				AssetBundleCreateRequest createRequest = keyValuePair2.Value.m_CreateRequest;
				if (createRequest.isDone)
				{
					LoadedAssetBundle loadedAssetBundle = new LoadedAssetBundle(createRequest.assetBundle);
					loadedAssetBundle.m_ReferencedCount = keyValuePair2.Value.m_ReferencedCount;
					value.LoadedAssetBundles.Add(keyValuePair2.Key, loadedAssetBundle);
					this.keysToRemove.Add(keyValuePair2.Key);
				}
			}
			foreach (string key in this.keysToRemove)
			{
				value.CreateAssetBundles.Remove(key);
			}
			int i = 0;
			while (i < value.InProgressOperations.Count)
			{
				if (!value.InProgressOperations[i].Update())
				{
					value.InProgressOperations.RemoveAt(i);
				}
				else
				{
					i++;
				}
			}
			this.keysToRemove.Clear();
		}
	}

	// Token: 0x060014A3 RID: 5283 RVA: 0x0008F9AC File Offset: 0x0008DBAC
	public static AssetBundleLoadAssetOperation LoadAsset(AssetBundleData data, Type type)
	{
		return AssetBundleManager.LoadAsset(data.bundle, data.asset, type, null);
	}

	// Token: 0x060014A4 RID: 5284 RVA: 0x0008F9C4 File Offset: 0x0008DBC4
	public static AssetBundleLoadAssetOperation LoadAsset(AssetBundleManifestData data, Type type)
	{
		return AssetBundleManager.LoadAsset(data.bundle, data.asset, type, data.manifest);
	}

	// Token: 0x060014A5 RID: 5285 RVA: 0x0008F9E0 File Offset: 0x0008DBE0
	public static AssetBundleLoadAssetOperation LoadAsset(string assetBundleName, string assetName, Type type, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = null;
		if (assetBundleLoadAssetOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, false, manifestAssetBundleName);
			assetBundleLoadAssetOperation = new AssetBundleLoadAssetOperationSimulation(bundlePack.LoadedAssetBundles[assetBundleName].m_AssetBundle.LoadAsset(assetName, type));
		}
		return assetBundleLoadAssetOperation;
	}

	// Token: 0x060014A6 RID: 5286 RVA: 0x0008FA3C File Offset: 0x0008DC3C
	public static AssetBundleLoadAssetOperation LoadAssetAsync(AssetBundleData data, Type type)
	{
		return AssetBundleManager.LoadAssetAsync(data.bundle, data.asset, type, null);
	}

	// Token: 0x060014A7 RID: 5287 RVA: 0x0008FA54 File Offset: 0x0008DC54
	public static AssetBundleLoadAssetOperation LoadAssetAsync(AssetBundleManifestData data, Type type)
	{
		return AssetBundleManager.LoadAssetAsync(data.bundle, data.asset, type, data.manifest);
	}

	// Token: 0x060014A8 RID: 5288 RVA: 0x0008FA70 File Offset: 0x0008DC70
	public static AssetBundleLoadAssetOperation LoadAssetAsync(string assetBundleName, string assetName, Type type, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = null;
		if (assetBundleLoadAssetOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, true, manifestAssetBundleName);
			assetBundleLoadAssetOperation = new AssetBundleLoadAssetOperationFull(assetBundleName, assetName, type, manifestAssetBundleName);
			bundlePack.InProgressOperations.Add(assetBundleLoadAssetOperation);
		}
		return assetBundleLoadAssetOperation;
	}

	// Token: 0x060014A9 RID: 5289 RVA: 0x0008FAC4 File Offset: 0x0008DCC4
	public static AssetBundleLoadAssetOperation LoadAllAsset(AssetBundleData data, Type type)
	{
		return AssetBundleManager.LoadAllAsset(data.bundle, type, null);
	}

	// Token: 0x060014AA RID: 5290 RVA: 0x0008FAD4 File Offset: 0x0008DCD4
	public static AssetBundleLoadAssetOperation LoadAllAsset(AssetBundleManifestData data, Type type)
	{
		return AssetBundleManager.LoadAllAsset(data.bundle, type, data.manifest);
	}

	// Token: 0x060014AB RID: 5291 RVA: 0x0008FAE8 File Offset: 0x0008DCE8
	public static AssetBundleLoadAssetOperation LoadAllAsset(string assetBundleName, Type type, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = null;
		if (assetBundleLoadAssetOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, false, manifestAssetBundleName);
			assetBundleLoadAssetOperation = new AssetBundleLoadAssetOperationSimulation(bundlePack.LoadedAssetBundles[assetBundleName].m_AssetBundle.LoadAllAssets(type));
		}
		return assetBundleLoadAssetOperation;
	}

	// Token: 0x060014AC RID: 5292 RVA: 0x0008FB44 File Offset: 0x0008DD44
	public static AssetBundleLoadAssetOperation LoadAllAssetAsync(AssetBundleData data, Type type)
	{
		return AssetBundleManager.LoadAllAssetAsync(data.bundle, type, null);
	}

	// Token: 0x060014AD RID: 5293 RVA: 0x0008FB54 File Offset: 0x0008DD54
	public static AssetBundleLoadAssetOperation LoadAllAssetAsync(AssetBundleManifestData data, Type type)
	{
		return AssetBundleManager.LoadAllAssetAsync(data.bundle, type, data.manifest);
	}

	// Token: 0x060014AE RID: 5294 RVA: 0x0008FB68 File Offset: 0x0008DD68
	public static AssetBundleLoadAssetOperation LoadAllAssetAsync(string assetBundleName, Type type, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		AssetBundleLoadAssetOperation assetBundleLoadAssetOperation = null;
		if (assetBundleLoadAssetOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, true, manifestAssetBundleName);
			assetBundleLoadAssetOperation = new AssetBundleLoadAssetOperationFull(assetBundleName, null, type, manifestAssetBundleName);
			bundlePack.InProgressOperations.Add(assetBundleLoadAssetOperation);
		}
		return assetBundleLoadAssetOperation;
	}

	// Token: 0x060014AF RID: 5295 RVA: 0x0008FBBC File Offset: 0x0008DDBC
	public static AssetBundleLoadOperation LoadLevel(AssetBundleData data, bool isAdditive)
	{
		return AssetBundleManager.LoadLevel(data.bundle, data.asset, isAdditive, null);
	}

	// Token: 0x060014B0 RID: 5296 RVA: 0x0008FBD4 File Offset: 0x0008DDD4
	public static AssetBundleLoadOperation LoadLevel(AssetBundleManifestData data, bool isAdditive)
	{
		return AssetBundleManager.LoadLevel(data.bundle, data.asset, isAdditive, data.manifest);
	}

	// Token: 0x060014B1 RID: 5297 RVA: 0x0008FBF0 File Offset: 0x0008DDF0
	public static AssetBundleLoadOperation LoadLevel(string assetBundleName, string levelName, bool isAdditive, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleLoadOperation assetBundleLoadOperation = null;
		if (assetBundleLoadOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, false, manifestAssetBundleName);
			SceneManager.LoadScene(levelName, (!isAdditive) ? LoadSceneMode.Single : LoadSceneMode.Additive);
			assetBundleLoadOperation = new AssetBundleLoadLevelSimulationOperation();
		}
		return assetBundleLoadOperation;
	}

	// Token: 0x060014B2 RID: 5298 RVA: 0x0008FC3C File Offset: 0x0008DE3C
	public static AssetBundleLoadOperation LoadLevelAsync(AssetBundleData data, bool isAdditive)
	{
		return AssetBundleManager.LoadLevelAsync(data.bundle, data.asset, isAdditive, null);
	}

	// Token: 0x060014B3 RID: 5299 RVA: 0x0008FC54 File Offset: 0x0008DE54
	public static AssetBundleLoadOperation LoadLevelAsync(AssetBundleManifestData data, bool isAdditive)
	{
		return AssetBundleManager.LoadLevelAsync(data.bundle, data.asset, isAdditive, data.manifest);
	}

	// Token: 0x060014B4 RID: 5300 RVA: 0x0008FC70 File Offset: 0x0008DE70
	public static AssetBundleLoadOperation LoadLevelAsync(string assetBundleName, string levelName, bool isAdditive, string manifestAssetBundleName = null)
	{
		if (manifestAssetBundleName.IsNullOrEmpty())
		{
			manifestAssetBundleName = "abdata";
		}
		AssetBundleManager.BundlePack bundlePack = AssetBundleManager.m_ManifestBundlePack[manifestAssetBundleName];
		AssetBundleLoadOperation assetBundleLoadOperation = null;
		if (assetBundleLoadOperation == null)
		{
			AssetBundleManager.LoadAssetBundle(assetBundleName, true, manifestAssetBundleName);
			assetBundleLoadOperation = new AssetBundleLoadLevelOperation(assetBundleName, levelName, isAdditive, manifestAssetBundleName);
			bundlePack.InProgressOperations.Add(assetBundleLoadOperation);
		}
		return assetBundleLoadOperation;
	}

	// Token: 0x0400190D RID: 6413
	public const string MAIN_MANIFEST_NAME = "abdata";

	// Token: 0x0400190E RID: 6414
	public const string Extension = ".unity3d";

	// Token: 0x0400190F RID: 6415
	private static HashSet<string> m_AllLoadedAssetBundleNames = new HashSet<string>();

	// Token: 0x04001910 RID: 6416
	private static AssetBundleManager.BundlePack MainBundle = null;

	// Token: 0x04001911 RID: 6417
	private static Dictionary<string, AssetBundleManager.BundlePack> m_ManifestBundlePack = new Dictionary<string, AssetBundleManager.BundlePack>();

	// Token: 0x04001912 RID: 6418
	private static string m_BaseDownloadingURL = string.Empty;

	// Token: 0x04001913 RID: 6419
	private static bool isInitialized = false;

	// Token: 0x04001914 RID: 6420
	private List<string> keysToRemove = new List<string>();

	// Token: 0x04001915 RID: 6421
	[CompilerGenerated]
	private static Func<string, string> callback0;

	// Token: 0x04001916 RID: 6422
	[CompilerGenerated]
	private static Func<string, string> callback1;

	// Token: 0x02000333 RID: 819
	public class BundlePack
	{
		// Token: 0x17000202 RID: 514
		// (get) Token: 0x060014BC RID: 5308 RVA: 0x0008FDA0 File Offset: 0x0008DFA0
		// (set) Token: 0x060014BD RID: 5309 RVA: 0x0008FDA8 File Offset: 0x0008DFA8
		public string[] Variants
		{
			get
			{
				return this.m_Variants;
			}
			set
			{
				this.m_Variants = value;
			}
		}

		// Token: 0x17000203 RID: 515
		// (get) Token: 0x060014BE RID: 5310 RVA: 0x0008FDB4 File Offset: 0x0008DFB4
		// (set) Token: 0x060014BF RID: 5311 RVA: 0x0008FDBC File Offset: 0x0008DFBC
		public AssetBundleManifest AssetBundleManifest
		{
			get
			{
				return this.m_AssetBundleManifest;
			}
			set
			{
				this.m_AssetBundleManifest = value;
			}
		}

		// Token: 0x17000204 RID: 516
		// (get) Token: 0x060014C0 RID: 5312 RVA: 0x0008FDC8 File Offset: 0x0008DFC8
		// (set) Token: 0x060014C1 RID: 5313 RVA: 0x0008FDD0 File Offset: 0x0008DFD0
		public Dictionary<string, LoadedAssetBundle> LoadedAssetBundles
		{
			get
			{
				return this.m_LoadedAssetBundles;
			}
			set
			{
				this.m_LoadedAssetBundles = value;
			}
		}

		// Token: 0x17000205 RID: 517
		// (get) Token: 0x060014C2 RID: 5314 RVA: 0x0008FDDC File Offset: 0x0008DFDC
		// (set) Token: 0x060014C3 RID: 5315 RVA: 0x0008FDE4 File Offset: 0x0008DFE4
		public Dictionary<string, AssetBundleCreate> CreateAssetBundles
		{
			get
			{
				return this.m_CreateAssetBundles;
			}
			set
			{
				this.m_CreateAssetBundles = value;
			}
		}

		// Token: 0x17000206 RID: 518
		// (get) Token: 0x060014C4 RID: 5316 RVA: 0x0008FDF0 File Offset: 0x0008DFF0
		// (set) Token: 0x060014C5 RID: 5317 RVA: 0x0008FDF8 File Offset: 0x0008DFF8
		public Dictionary<string, string> DownloadingErrors
		{
			get
			{
				return this.m_DownloadingErrors;
			}
			set
			{
				this.m_DownloadingErrors = value;
			}
		}

		// Token: 0x17000207 RID: 519
		// (get) Token: 0x060014C6 RID: 5318 RVA: 0x0008FE04 File Offset: 0x0008E004
		// (set) Token: 0x060014C7 RID: 5319 RVA: 0x0008FE0C File Offset: 0x0008E00C
		public List<AssetBundleLoadOperation> InProgressOperations
		{
			get
			{
				return this.m_InProgressOperations;
			}
			set
			{
				this.m_InProgressOperations = value;
			}
		}

		// Token: 0x17000208 RID: 520
		// (get) Token: 0x060014C8 RID: 5320 RVA: 0x0008FE18 File Offset: 0x0008E018
		// (set) Token: 0x060014C9 RID: 5321 RVA: 0x0008FE20 File Offset: 0x0008E020
		public List<LoadedAssetBundleDependencies> Dependencies
		{
			get
			{
				return this.m_Dependencies;
			}
			set
			{
				this.m_Dependencies = value;
			}
		}

		// Token: 0x0400191C RID: 6428
		private string[] m_Variants = new string[0];

		// Token: 0x0400191D RID: 6429
		private AssetBundleManifest m_AssetBundleManifest;

		// Token: 0x0400191E RID: 6430
		private Dictionary<string, LoadedAssetBundle> m_LoadedAssetBundles = new Dictionary<string, LoadedAssetBundle>();

		// Token: 0x0400191F RID: 6431
		private Dictionary<string, AssetBundleCreate> m_CreateAssetBundles = new Dictionary<string, AssetBundleCreate>();

		// Token: 0x04001920 RID: 6432
		private Dictionary<string, string> m_DownloadingErrors = new Dictionary<string, string>();

		// Token: 0x04001921 RID: 6433
		private List<AssetBundleLoadOperation> m_InProgressOperations = new List<AssetBundleLoadOperation>();

		// Token: 0x04001922 RID: 6434
		private List<LoadedAssetBundleDependencies> m_Dependencies = new List<LoadedAssetBundleDependencies>();
	}
}
